package forumSystem;


import java.util.Vector;

public interface ForumData {
	
	/**
	 * @function initialize
	 * this function initialize all vector's , and sets the adminUsername and adminPass to 
	 * @param adminUsername
	 * @param pass
	 * 
	 */
	abstract void initialize(String adminUsername ,String pass);
	
	/**
	 * @function getAdminUserName
	 * @return admin user name
	 */
	abstract String getAdminUserName();
	
	/**
	 * @function getAdminPass
	 * @return admin password
	 */
	abstract String getAdminPass();
	
	/**
	 * @function addForum
	 * @param name
	 * @param desc
	 * add forum to storage
	 * @return forumID in success or -1 in error
	 */
	abstract int addSubForum(String name, String desc, int parent, int moderatorId);
	
	/**
	 * @function addSubForum
	 * @param name
	 * @param desc
	 * @param parent
	 * add forum to storage with parentid=parent
	 * @return forumID in success or -1 in error
	 */
	abstract int addForum(String name, String desc);
	
	/**
	 * @function addManagerToForum
	 * @param forumID - id of the specified forum 
	 * @param userid - id of the manager 
	 * this function finds the forum with id=forumID and sets the managerid to userid
	 * @return forumID in success or -1 in error
	 */	
	abstract int addManagerToForum(int forumID, int userid);
	
	/**
	 * @function addForumWithManager
	 * add this forum to forum collection and set managerid to userID
	 * @return forumID in success or -1 in error
	 */
	abstract int addForumWithManager(String forumName, String forumDesc, int userID);
	
	/**
	 * @function addModerateToSubForum
	 * @param subForumID
	 * @param moderateID
	 * @return subforum id in case of success and -1 in case of error
	 */
	abstract int addModerateToSubForum(int subForumID, int moderateID);
	
	/**
	 * @function:getFuromlist
	 * @return vector of all parent forums
	 * that is , all the forums with parentID 0
	 */
	abstract Vector<Forum> getForumlist();	
	
	/**
	 * @function:getSubFuromlist
	 * @return vector of all child forums of
	 * @param parent
	 * that is , all the forums with parentID 0; //parent
	 */
	abstract Vector<SubForum> getSubForumslist(int parent);	
	
	/**
	 * function getForumByID
	 * @param forumID
	 * @return the forum who has that id 
	 */
	abstract Forum getForumByID(int forumID);
	abstract Vector<Post> getForumPosts(int forumID);
	
	/**
	 * function getSubForumByID
	 * @param subforumID
	 * @return the subforum who has that id 
	 */
	abstract SubForum getSubForumByID(int subforumID);
	
	/**
	 * @function addUser
	 * add user to DB with username and pass
	 * @param username
	 * @param pass
	 * @return id of new user and -1 in case of error
	 */
	abstract int addUser(String username, String pass, int forumId);
	
	/**
	 * function getUserByID 
	 * @param id
	 * @return user who has this id
	 */
	abstract User getUserByID(int id);
	abstract User getUserByUserName(String username);
	abstract boolean isUserExist(String username, String pass);
	
	/**
	 * @function changeUserRank
	 * this function should change the rank of user id : userID to rank
	 * @param rank
	 * @param userID 
	 * @return userId in success and -1 in error
	 */
	abstract int changeUserRank(int userID, Rank rank);
	
	/**
	 * @function addPost
	 * @param userID
	 * @param subforumID
	 * @param title
	 * @param desc
	 * this function add post to storage
	 * @return post id in case of success and -1 in case of error
	 */
	abstract int addPost(int userID ,int subforumID,  String title , String desc);
	
	/**
	 * @function getSubForumPosts
	 * @param subforumID
	 * @return vector of all posts in current subforum
	 */
	abstract Vector<Post> getSubForumPosts(int subforumID);
	
	/**
	 * @function addreply 
	 * @param userID
	 * @param Postid
	 * @param content
	 * add reply to storage
	 * @return reply id or -1 in case of error
	 */
	abstract int addReply(int userID, int Postid , String content);
	
	/**
	 * @function getPostReaplies
	 * @param postID
	 * @return vector of replies of postid
	 */
	abstract Vector<Reply> getPostReplies(int postID);
	
	/**
	 * @function getUsers
	 * @return vector of all the Users
	 */
	abstract Vector<User> getUsers();
	abstract Post getPostByID(int id);
}
